/**
 * @author 13771
 * @date 2021/2/24 16:55
 * @description 分治算法求x的n次幂
 */
public class work2 {
    public static int divide(int x, int n){
        if (n==1) return x;
        int half = divide(x,n/2);
        if (n%2 == 0){
            return half*half;
        }else {
         return half*half*x;
        }
    }

    public static void main(String[] args) {
        int divide = divide(2, 11);
        System.out.println(divide);
    }
}
